package thread;

public class SleepDemo2 {
    public static void main(String[] args) {
        Thread ling = new Thread("林大健") {
            public void run() {
                System.out.println(getName() + ":刚敷上面膜准备睡觉");
                try {
                    Thread.sleep(10000000);
                } catch (InterruptedException e) {
                    System.out.println(getName() + ":干嘛呢！不睡觉了？");
                }
                System.out.println(getName() + ":醒了");
            }
        };


        Thread huang = new Thread("黄大锤") {
            public void run() {
                System.out.println(getName() + ":大锤80！小锤40！");
                for (int i = 0; i < 5; i++) {
                    try {
                        Thread.sleep(2000);
                        System.out.println(getName() + ":80!");
                    } catch (InterruptedException e) {
                    }
                }
                System.out.println("哐当！");
                System.out.println(getName() + ":大哥搞定了");
                ling.interrupt();//huang线程去中断lin线程的睡觉堵塞
            }
        };

        ling.start();
        huang.start();
    }
}
